package com.carey.blog.framework.latke.jsonrpc;

/**
 * Abstract json RPC service.
 * 
 */
public abstract class AbstractJSONRpcService {

	/**
	 * JavaScirpt client service object name.
	 */
	private String serviceObjectName = genServiceObjectName();

	/**
	 * Gets the JavaScirpt client service object name.
	 * 
	 * @return service object name
	 */
	public final String getServiceObjectName() {
		return serviceObjectName;
	}

	/**
	 * Generates service object name for this object.
	 * 
	 * @return the generated service object name
	 */
	private String genServiceObjectName() {
		final String simpleName = getClass().getSimpleName();
		final char firstChar = simpleName.charAt(0);

		return Character.toLowerCase(firstChar) + simpleName.substring(1);
	}
}
